/*mui.init({
	preloadPages: [ {
		"id": "main-inout",
		"url": "./src/main-inout.html",
		"styles": {
			"top": '44px',
			"bottom": '52px',
			"popGesture": "hide"
		}
	}, {
		"id": "main-center",
		"url": "./src/main-center.html",
		"styles": {
			"top": '44px',
			"bottom": '52px',
			"popGesture": "hide"
		}
	}, {
		"id": "main-jxs",
		"url": "./src/main-jxs.html",
		"styles": {
			"top": '44px',
			"bottom": '52px',
			"popGesture": "hide"
		}
	}]
});
 		*/
function openWindow(url,id,extraData) {
	mui.openWindow({
			url: url,
			id: id,
			styles: {
				top: 0, //新页面顶部位置
				bottom: 0, //新页面底部位置
			},
			extras:extraData , //自定义扩展参数，可以用来处理页面间传值
			createNew: false, //是否重复创建同样id的webview，默认为false:不重复创建，直接显示
			show: {
				autoShow: true, //页面loaded事件发生后自动显示，默认为true
				aniShow: 'slide-in-right', //页面显示动画，默认为”slide-in-right“；
			},
			waiting: {
				autoShow: true, //自动显示等待框，默认为true
				title: '正在加载...', //等待对话框上显示的提示内容
			}
		})
};
	var items = document.querySelectorAll('footer .mui-tab-item');
	var currentId='index';
	for(var i = 0; i < items.length; i++) {
		items[i].addEventListener('tap', function() {
			var id = this.getAttribute('id');
			var wvs = plus.webview.all();
			console.log(wvs);
			if(id) {
				if(currentId != id){
					if(id == 'index') {
						//				plus.webview.getWebviewById('index').evalJS('initMain(mui, Ks, false, function(){});');
						openWindow('./index.html','index',{});
					} else if(id == 'main-inout') {
						//				plus.webview.getWebviewById('index').evalJS('initMain(mui, Ks, false, function(){});');
						openWindow('./main-inout.html','main-inout',{});
					} else if(id == 'main-center') {
						//				plus.webview.getWebviewById('index').evalJS('initMain(mui, Ks, false, function(){});');
						openWindow('./main-center.html','main-center',{});
					} else if(id == 'main-jxs') {
						//				plus.webview.getWebviewById('index').evalJS('initMain(mui, Ks, false, function(){});');
						openWindow('./main-jxs.html','main-jxs',{});
					}
				}	
				
			}
		})
	}
	
/*(function($) {
	$.plusReady(function() {
		var mainMv = plus.webview.currentWebview();
		var showGuide = plus.storage.getItem("lauchFlag");//读取本地存储，检查是否为首次启动
		if (showGuide) {
			//有值，说明已经显示过了，无需显示；
			//关闭splash页面；
			plus.navigator.closeSplashscreen();
			plus.navigator.setFullscreen(false);
		 
		} else {
		 
		}
		
	})
}(mui))*/